class Task17:
    def run(self, n):
        buffer = ['0' for _ in range(n)]
        self.run_recursive(n, buffer, -1)

    def run_recursive(self, n, buffer, index):
        if index == n - 1:
            self.print_trim_zero(buffer)
        else:
            for i in range(10):
                buffer[index + 1] = str(i)
                self.run_recursive(n, buffer, index + 1)

    def print_trim_zero(self, array):
        i = 0
        while i < len(array) and array[i] == '0':
            i += 1
        if i == len(array):
            print('0')
        else:
            print(''.join(array[i:]))
